Simple Status Bar Clock

This script sets the status bar text to the current time when a button is pressed.



Discussion

This script uses the function setMessage() to set the status bar's text by changing the window.status object. Some early Netscape Navigator 2.0 releases do not produce the correct time. This will be fixed in future releases.

The function setMessage

function setMessage(){
    var now = new Date();
    var statusStr = now.getHours()+':';
    var statusMin = now.getMinutes();
    if(parseInt(statusMin) < 10)
        statusStr += '0';
    statusStr += statusMin;		
    window.status = ("The time is "+statusStr);
}
        
Copyright ©1998 by Charles River Media, All Rights Reserved